package demo3;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86138
 * Date: 2024-10-16
 * Time: 17:06
 */
public class S {
    public int num;
    public String name;
    public int[] score;

    //第一个构造方法
    public S(String name, int[] score){
        this.name = name;
        this.score = score;
    }

    //第二个构造方法
    public S(String name,int[] score,int num){
        this.name = name;
        this.num = num;
        this.score = score;
    }


    //平均值
    public double ave(){
        double sum = 0;
        double ave = 0;
        for(int i = 0;i < score.length;i++){
            sum += score[i];
        }
        ave = sum/3;
        return ave;
    }


    //最大值
    public double max(int[] score){
        Arrays.sort(score);
        return score[score.length-1];
    }


    //最小值
    public double min(int[] score){
        Arrays.sort(score);
        return score[0];
    }


}
